how to deploy v2ray client on k8s¶
create a configmap
kubectl create configmap v2ray --from-file=/etc/v2ray/config.jsoncreate a pod
an example yaml file:
apiVersion: v1 kind: Pod metadata: name: v2ray spec: nodeName: node containers: - name: v2ray image: v2ray/official volumeMounts: - name: v2ray mountPath: /etc/v2ray/config.json subPath: config.json imagePullPolicy: IfNotPresent command: [ "/bin/sh" ] args: ["-c","v2ray -config=/etc/v2ray/config.json"] volumes: - name: v2ray configMap: name: v2raykubectl create -f pod.yamlcreate a pod label
kubectl get pod --show-labels kubectl label pod v2ray app=v2raycreate a service
an example yaml file:
apiVersion: v1 kind: Service metadata: name: v2ray spec: selector: app: v2ray type: NodePort ports: - protocol: TCP port: 1080 targetPort: 1080 nodePort: 30000kubectl create -f service.yamlat last, you can use tcpdump port 10080 to monitor network traffic comes from k8s master(if used) and node on v2ray server.